package org.sidora.strata.sector;

import java.awt.event.ActionEvent;
import javax.swing.AbstractAction;
import javax.swing.ImageIcon;
import org.openide.util.NbBundle;
import org.openide.util.Utilities;
import org.openide.windows.TopComponent;

/**
 * Action which shows Sector component.
 * @author Enric Tartera, Juan Manuel Gimeno, Roger Masgoret
 * @version 1.0
 */
public class SectorAction extends AbstractAction {
    
    public SectorAction() {
        super(NbBundle.getMessage(SectorAction.class, "CTL_SectorAction"));
        putValue(SMALL_ICON, new ImageIcon(Utilities.loadImage(SectorTopComponent.ICON_PATH, true)));
    }
    
    public void actionPerformed(ActionEvent evt) {
        TopComponent win = SectorTopComponent.findInstance();
        win.open();
        win.requestActive();
    }
    
    public void actionPerformed() {
        SectorTopComponent win = SectorTopComponent.findInstance();
        win.open();
        win.requestActive();
        win.fillSectorItems();
    }
    
    public void saveFields(){
        SectorTopComponent win = SectorTopComponent.findInstance();
        win.saveSectorFields();
    }
    
    public void cerrar(){
        SectorTopComponent win = SectorTopComponent.findInstance();
        win.close();
    }
    
}
